package com.miracle9.game.dao;
import com.miracle9.game.entity.UserWarningBak;
import java.util.List;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

@Repository
public class UserWarningBakServiceDao extends SqlOperating<UserWarningBak, Integer>
{
  public boolean updateBak(UserWarningBak userWarningBak)
  {
    int cnt = q_CreateSql(
      "update UserWarningBak set yaGold=?,deGold=?,giveGold=?,deductGold=?,payCount=?,expiryCount=?,gameGold=?,date=? where userId=?", new Object[] {
      Double.valueOf(userWarningBak.getYaGold()), Double.valueOf(userWarningBak.getDeGold()), 
      Long.valueOf(userWarningBak.getGiveGold()), Long.valueOf(userWarningBak.getDeductGold()), 
      Long.valueOf(userWarningBak.getPayCount()), Long.valueOf(userWarningBak.getExpiryCount()), 
      Long.valueOf(userWarningBak.getGameGold()), userWarningBak.getDate(), 
      Integer.valueOf(userWarningBak.getUserId()) }).executeUpdate();
    
    return cnt > 0;
  }
  
  public void deleteByNUserId(int nUserId)
  {
	  q_CreateSql("delete UserWarningBak where userId=?", new Object[] { Integer.valueOf(nUserId) }).executeUpdate();
  }
  
  public List<UserWarningBak> getUserWarningBaks()
  {
    return q_CreateSqlList("from UserWarningBak", new Object[0]);
  }
  
  public UserWarningBak getByUId(int nUserId)
  {
    return (UserWarningBak)q_CreateSqlFilter("from UserWarningBak where userId=?", new Object[] { Integer.valueOf(nUserId) });
  }
}
